package org.apache.cordova;

import android.os.Handler;
import android.os.Message;
import android.util.Log;

import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;

public class ScanFile{

    public static void scanCountFile(String mFilePath) {
        if (mFilePath == null) {
            return;
        }
        final File file = new File(mFilePath);

        //非目录或者目录不存在直接返回
        if (!file.exists() || file.isFile()) {
            return;
        }
        //获取到根目录下的文件和文件夹
        final File[] files = file.listFiles(new FilenameFilter() {
            @Override
            public boolean accept(File file, String s) {
                //过滤掉隐藏文件
                return !file.getName().startsWith(".");
            }
        });
        for (File f : files) {
            Log.d("ScanFile","path = "+f.getPath());
            if (f.isDirectory()){
                scanCountFile(f.getPath());
            }

        }
    }
}
